<%--
  Created by IntelliJ IDEA.
  User: YE
  Date: 2018-06-06
  Time: 10:03
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<c:set var="ctx" value="${pageContext.request.contextPath}"/>
<html>
<head>
    <meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no">
    <title>查询群信息</title>
    <link rel="stylesheet" type="text/css" href="${ctx}/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="${ctx}/css/main.css">
    <script src="${ctx}/js/jquery-3.3.1.js"></script>
    <script src="${ctx}/js/bootstrap.min.js"></script>
	<script src="${ctx}/js/click.js"></script>
</head>
<body>
<c:if test="${empty sessionScope.user}">
    <script>
        location.href="${ctx}/login.jsp";
    </script>
</c:if>
<c:if test="${!empty requestScope.message}">
    <script>
        alert("${requestScope.message}");
    </script>
</c:if>
<div class="container">
    <a class="rt" href="/">回到首页</a>
    <a class="rt" href="/user/logout">注销</a>
    <h2>查询群信息</h2>
    <form action="/search/quninfo" target="_self" method="get">
        <input id="qun" name="qun" type="text" class="form-control" placeholder="请输入群号"/>
        <input id="search" type="submit" class="btn btn-default" value="查询"/>
    </form>
    <c:choose>
        <c:when test="${empty requestScope.time}">
            <span id="ps">ps:QQ查询比较慢，大约10-30秒</span>
        </c:when>
        <c:otherwise>
            <span id="ps">查询完毕，用时${requestScope.time}秒</span>
        </c:otherwise>
    </c:choose>
    <table style="width:100%;margin-top:5%" class="table">
        <thead>
        <th>ID</th>
        <th>群号</th>
        <th>MastQQ</th>
        <th>创建日期</th>
        <th>标题</th>
        <th>Class</th>
        <th>群信息</th>
        </thead>
        <tbody>
        <c:choose>
            <c:when test="${empty requestScope.qunInfo}">
            </c:when>
            <c:otherwise>
                <c:set var="quninfo" value="${requestScope.qunInfo}"></c:set>
                <tr>
                    <td>${quninfo.id}</td>
                    <td><a href="/search/group?qun=${quninfo.qunNum}">${quninfo.qunNum}</a></td>
                    <td>${quninfo.mastQq}</td>
                    <td>${quninfo.createDate}</td>
                    <td>${quninfo.title}</td>
                    <td>${quninfo.clazz}</td>
                    <td>${quninfo.qunText}</td>
                </tr>
            </c:otherwise>
        </c:choose>
        </tbody>
    </table>
</div>
</body>
</html>
